package org.zhadoop.stream.cql.semanticanalyzer.parser.visitor;

import org.zhadoop.stream.cql.CQLUtils;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.ConfNameContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.ConfValueContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.context.KeyValuePropertyContext;

public class KeyValuePropertyVisitor extends AbsCQLParserBaseVisitor<KeyValuePropertyContext>{

	private KeyValuePropertyContext context = null;
	
	public KeyValuePropertyVisitor() {
		context = new KeyValuePropertyContext();
	}
	
	@Override
	protected KeyValuePropertyContext defaultResult() {
		return context;
	}
	
	@Override
	public KeyValuePropertyContext visitConfName(ConfNameContext ctx) {
		context.setKey(CQLUtils.cqlStringLiteralTrim(ctx.getText()));
		return super.visitConfName(ctx);
	}
	
	@Override
	public KeyValuePropertyContext visitConfValue(ConfValueContext ctx) {
		context.setValue(CQLUtils.cqlStringLiteralTrim(ctx.getText()));
		return context;
	}

}
